from unittest import TestCase
import unittest
import httpqueryparser as Parser

class TestQueryParser(TestCase):
    def test_set_string(self):
        parser = Parser.httpQueryParser("TheString")
        self.assertEqual("TheString", parser.getString())

    def test_dictionary(self):
        parser = Parser.httpQueryParser("")
        self.assertEqual(dict(), parser.getDict())

    def test_parse_single(self):
        parser = Parser.httpQueryParser("http://www.ru.is/?course=hugb&exercise=tdd")
        self.assertEqual("hugb", parser.getValue("course"))
        self.assertEqual(-1, parser.getValue("ekkitil"))
                                        
    
                
if __name__ == "__main__":
    unittest.main()
